poloyy-archive
首页 / Jmeter 常用函数 / Jmeter 常用函数(19)- 详解 __BeanShell

Jmeter 常用函数(19)- 详解 __BeanShell

Jmeter 常用函数  ·  原文归档  ·  点击图片可放大

https://www.cnblogs.com/poloyy/p/13291704.htm

作用

执行 BeanShell 脚本,并返回结果

语法格式

${__BeanShell(123*456,name)}

参数讲解

字段 含义 是否必传
BeanShell BeanShell 脚本 yes
Variable Name 存储脚本返回结果的变量名 no

小栗子

设置 Jmeter 变量

${__BeanShell(vars.put("yytest"\,"${__Random(1000,5555)}"),)}

读取 Jmeter 变量

${__BeanShell(vars.get("yytest"),)}

设置 Jmeter 属性

${__BeanShell(props.put("yytest"\,"1234"),)}

读取 Jmeter 属性

${__BeanShell(props.get("yytest"),)}

重点

BeanShell 能写啥,这里也能写啥,不过要记住这是简化版的 BeanShell,是为了方便而已,不是完全可代替哦

上一篇Jmeter 常用函数(18)- 详解 __isDefined 下一篇Jmeter 常用函数(1)- 详解 __Random